package windbell.domain.risk.impl;

import edu.fudan.mylang.pf.BaseDAOService;
import edu.fudan.mylang.utils.DateUtil;
import java.util.Date;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import windbell.domain.risk.RiskCheckFromPark;
import windbell.domain.risk.RiskCheckFromParkDAO;
import windbell.domain.risk.RiskCheckSourceType;
import windbell.domain.risk.RiskCheckTemplate;
import windbell.domain.risk.events.RiskCheckEventsManager;
import windbell.domain.risk.impl.RiskCheckFromParkImpl;

@Service("windbell.domain.risk.RiskCheckFromParkDAO")
public class RiskCheckFromParkDAOImpl extends BaseDAOService<RiskCheckFromPark> implements RiskCheckFromParkDAO {
  @Autowired
  private RiskCheckEventsManager events;
  
  public RiskCheckFromPark create(final RiskCheckTemplate checkTemplate, final Procedure1<? super RiskCheckFromPark> init) {
    RiskCheckFromPark riskCheckFromPark=RiskCheckFromParkImpl.create(checkTemplate,getObjectFactory());
    
    final Procedure1<RiskCheckFromPark> _function = new Procedure1<RiskCheckFromPark>() {
        public void apply(final RiskCheckFromPark it) {
          it.setType(RiskCheckSourceType.park);
          Date _day = DateUtil.today();
          it.setDate(_day);
          init.apply(it);
        }
      };
    RiskCheckFromPark _doubleArrow = ObjectExtensions.<RiskCheckFromPark>operator_doubleArrow(riskCheckFromPark, _function);
    return _doubleArrow;
  }
}
